home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / os2 / fbimon.zip / EmxRexx / FBiMonApi.c < prev    next >
C/C++ Source or Header  |  1997-05-21  |  2KB  |  78 lines

  1. /* FBiMonApi.c */
  2. #include "FBiMonApi.h"
  3.  
  4. HFILE FBiMonID=0;      // FBiMon DD handle
  5.  
  6. int FBiMonInit() {
  7.    ULONG action;
  8.    if (DosOpen("FBIMON$",&FBiMonID,&action,0,FILE_NORMAL,FILE_OPEN, OPEN_ACCESS_READWRITE | OPEN_SHARE_DENYREADWRITE,0)==0) return 1;
  9.    return 0;
  10. }
  11.  
  12. void FBiMonClose() {
  13.    FBiMonSetMode(0);
  14.    if (FBiMonID) DosClose(FBiMonID);
  15. }
  16.  
  17. void FBiMonSetMode(int mode) {
  18.    ScreenMode Dummy;
  19.    ULONG BytesWritten;
  20.  
  21.    Dummy.Command=ScreenModeCmd;
  22.    Dummy.Md=mode;
  23.    DosWrite(FBiMonID,&Dummy,sizeof(Dummy),&BytesWritten);
  24. }
  25.  
  26. void FBiMonWriteString(char *buffer,int x,int y) {
  27.    ScreenPrintIn DummyStr;
  28.    ScreenPosition DummyPos;
  29.    ULONG BytesWritten;
  30.  
  31.    FBiMonSetPos(x,y);
  32.  
  33.    DummyStr.Command=PrintCmd;
  34.    DummyStr.Length=strlen(buffer);
  35.    strcpy(DummyStr.Msg,buffer);
  36.    DosWrite(FBiMonID,&DummyStr,sizeof(DummyStr),&BytesWritten);
  37. }
  38.  
  39. void FBiMonSetPos(int x,int y) {
  40.    ScreenPosition DummyPos;
  41.    ULONG BytesWritten;
  42.  
  43.    DummyPos.Command=ScreenPositionCmd;
  44.    DummyPos.spx=x;
  45.    DummyPos.spy=y;
  46.    DosWrite(FBiMonID,&DummyPos,sizeof(DummyPos),&BytesWritten);
  47. }
  48.  
  49. void FBiMonWriteTTY(char *buffer) {
  50.    ScreenPrintIn DummyStr;
  51.    ULONG BytesWritten;
  52.  
  53.    DummyStr.Command=PrintCmd;
  54.    DummyStr.Length=strlen(buffer);
  55.    strcpy(DummyStr.Msg,buffer);
  56.    DosWrite(FBiMonID,&DummyStr,sizeof(DummyStr),&BytesWritten);
  57. }
  58.  
  59. void FBiMonAttribute(char att) {
  60.    ScreenAttribute Dummy;
  61.    ULONG BytesWritten;
  62.  
  63.    Dummy.Command=ScreenAttributeCmd;
  64.    Dummy.Att=att;
  65.    DosWrite(FBiMonID,&Dummy,sizeof(Dummy),&BytesWritten);
  66. }
  67.  
  68. void FBiMonSetCursorAspect(char first,char second,char options) {
  69.    SetCursorAspect Dummy;
  70.    ULONG BytesWritten;
  71.  
  72.    Dummy.Command=SetCursorAspectCmd;
  73.    Dummy.first=first;
  74.    Dummy.second=second;
  75.    Dummy.options=options;
  76.    DosWrite(FBiMonID,&Dummy,sizeof(Dummy),&BytesWritten);
  77. }
  78.